from core.item import Item
from core.action import Action
from rooms.victory_room import VictoryRoom

class Cellphone(Item):
    def __init__(self):
        Item.__init__(self, "cellphone")    # do basic initialization for every item
        
        # build list of actions
        self.add_action(CallPeteThornton)
    
    def get_description(self):
            return "a cellphone"

    def get_image(self):
        return 'images/items/cellphone.jpg'
# define actions for this item

class CallPeteThornton(Action):
    def __init__(self):
        Action.__init__(self, "call_thornton")    # do basic initialization for every action
        
    # this method gets called when action executed.  can be overridden in subclass
    def do_action(self,game,room,request):
        game.get_room('victory_room',VictoryRoom).set_image('helicopter.jpg')
        game.get_room('victory_room',VictoryRoom).set_description('You called Pete Thornton, who picked you up in a helicopter.  You have won the game!  Congratulations!')
        return
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Call Pete Thornton"
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'victory_room'